package com.ahao.aggregation.utils;
import android.content.Context;
import android.util.DisplayMetrics;
import android.view.WindowManager;

public class ScreenUtils {
    /**
     * 获取屏幕宽高
     * @param context 上下文
     * @return 返回数据
     */
    public static DisplayMetrics getDisplayMetrics(Context context){
        //获取屏幕宽度
        WindowManager wm = (WindowManager) context.getApplicationContext().getSystemService(Context.WINDOW_SERVICE);
        DisplayMetrics outMetrics = new DisplayMetrics();
        wm.getDefaultDisplay().getMetrics(outMetrics);
        return outMetrics;
    }
}
